'''
Created on Dec 9, 2012

@author: hbliu
'''

import MySQLdb

class Hello:
    def __init__(self):
        print 'this is init'
        self.date = 'today is 2012'
    def __del__(self):
        print 'close'
        
    def con_db(self):
        self.con = MySQLdb.connect(host='localhost', user='root', passwd='hbliu')
        self.cur = self.con.cursor()
        self.con.select_db('sina_weibo')
    def insert_db(self):
        value = [123, 'liu', 'hong']
        self.cur.execute('insert into test values(%s,%s,%s)', value);
        self.con.commit()
    

test = Hello()
test.con_db()
test.insert_db()